/**
 * 遍历轨迹所有点获取离给定点最近的点。
 * allPoints 中定义的某个点，按照逗号split后，经纬度的index为【0】、【1】
 **/
function findNearestPoint(lng,lat,allPoints){
	var temp0 = 0;
	var temp1 = 0;
	var rootArr = new Array();
	if((typeof(allPoints)=="string")){
		rootArr = allPoints.split(";");
	}else{
		rootArr = allPoints;
	}
	var tempArr = new Array();
	var reArr = new Array();
	for(var index=0;index < rootArr.length;index++){
		tempArr = rootArr[index].split(",");
		temp1 = square(Math.abs(lng) - Math.abs(tempArr[0]))+square(Math.abs(lat) - Math.abs(tempArr[1]));
		if(index == 0){
			temp0 = temp1;
			reArr = tempArr;
		}else{
			if(temp1 ==0 ){ 
				break;
			}else{
				if(temp1 < temp0){
					temp0 = temp1;
					reArr = tempArr;
				}
			}
		}
	}
	return reArr;
}
/**
 * 计算一个数的平方
 **/
function square(num){
	return num*num;
}